package org.callisto.model;

import java.sql.Timestamp;

import org.callisto.EventType;

public class Event {
	long millis;
	EventType status;
	int note, pressure, delay;
	Timestamp tstamp;
	
	public Timestamp getTstamp() {
		return tstamp;
	}

	public long getMillis() {
		return millis;
	}
	
	public int getNote() {
		return note;
	}
	
	public EventType getStatus() {
		return status;
	}
	
	public int getPressure() {
		return pressure;
	}
	
	public int getDelay() {
		return delay;
	}
	
	public int getMeasure() {
		int r=0;
		if (status == EventType.NOTE_ON) {
			r=pressure;
		}
		if (status == EventType.NOTE_OFF) {
			r=delay;
		}
		return r;
	}
	
	public Event(long millis, Timestamp tstamp, int note, EventType status, int pressure, int delay) {
		super();
		this.millis = millis;
		this.tstamp = tstamp;
		this.note = note;
		this.status = status;
		this.pressure = pressure;
		this.delay = delay;
	}
	
	public String toString() {
		return "[" + millis + " | " + tstamp + "] n=" + note + ", p=" + pressure + ", d=" + delay + ", s=" + status;
	}
	
	public String getShortDesc() {
		int r=0;
		if (status == EventType.NOTE_ON) {
			r=pressure;
		}
		if (status == EventType.NOTE_OFF) {
			r=delay;
		}
		return "[" + note + " : " + r + "]";
	}
}
